/**
 * Created by Adi(adi@imeth.cn) on 2018/9/3.
 */
import {
  queryPayChannelList,
  freezePayChannel,
  activatePayChannel,
  savePayChannel,
  updatePayChannel,
  getPayChannelById,
} from '../services/platfrom';
import { Request } from 'src/common/Request';

const modelRequest = new Request([
  {
    type: 'payChannelList',
    requestWay: queryPayChannelList,
  },
  {
    type: 'getById',
    requestWay: getPayChannelById,
  },
  {
    type: 'freeze',
    requestWay: freezePayChannel,
  },
  {
    type: 'activate',
    requestWay: activatePayChannel,
  },
  {
    type: 'save',
    requestWay: savePayChannel,
  },
  {
    type: 'update',
    requestWay: updatePayChannel,
  },
]);

export default {
  namespace: 'PayChannel',

  state: {
    payChannelList: [],
    payChannelDetail: {},
    freezeStatus: {},
    activateStatus: {},
    saveStatus: {},
    updateStatus: {},
  },

  effects: modelRequest.effects,
  // {
  // // 获取列表
  // * payChannelList(action, {call, put, select}) {
  //   // yield effectsRequest('queryPayChannelList', payload, effects, queryPayChannelList);
  // },
  // // 获取详情
  // * getById({ payload = {} }, effects) {
  //   // yield effectsRequest('getPayChannelDetail', payload.id, effects, getPayChannelById);
  // },
  // // 新增
  // * save({ payload = {} }, effects) {
  //   // yield effectsRequest('savePayChannel', payload, effects, savePayChannel);
  // },
  // // 修改
  // * update({ payload = {} }, effects) {
  //   // yield effectsRequest('updatePayChannel', payload, effects, updatePayChannel);
  // },
  // // 冻结
  // * freeze({ payload = {} }, effects) {
  //   // yield effectsRequest('freezePayChannel', payload, effects, freezePayChannel);
  // },
  // // 激活
  // * activate({ payload = {} }, effects) {
  //   // yield effectsRequest('activatePayChannel', payload, effects, activatePayChannel);
  // },
  // },

  reducers: modelRequest.reducer,
  // {
  //   queryPayChannelList(state, action) {
  //     return {
  //       ...state,
  //       payChannelList: action.payload,
  //     };
  //   },
  //   getPayChannelDetail(state, action) {
  //     return {
  //       ...state,
  //       payChannelDetail: action.payload,
  //     };
  //   },
  //   savePayChannel(state, action) {
  //     return {
  //       ...state,
  //       saveStatus: action.payload,
  //     };
  //   },
  //   updatePayChannel(state, action) {
  //     return {
  //       ...state,
  //       updateStatus: action.payload,
  //     };
  //   },
  //   freezePayChannel(state, action) {
  //     return {
  //       ...state,
  //       freezeStatus: action.payload,
  //     };
  //   },
  //   activatePayChannel(state, action) {
  //     return {
  //       ...state,
  //       activateStatus: action.payload,
  //     };
  //   },
  // },
};
